(function($, window, document, undefined) {
  
  // 输入提示
  // 插件地址： https://github.com/bassjobsen/Bootstrap-3-Typeahead

  var $input = $('#search')

  $input.typeahead({
    source: [
      {id: "someId1", name: "Display name 1"},
      {id: "someId2", name: "Display name 2"},
      {id: "someId3", name: "Display name 3"},
      {id: "someId4", name: "Display name 4"},
      {id: "someId5", name: "Display name 5"},
      {id: "someId6", name: "Display name 6"},
      {id: "someId7", name: "Display name 7"}
    ]
  })
  
  /* 奖池 */
  +(function() {
    
    var $digit_pt = $('#jackpot-digit-pt'),
        $digit_dt = $('#jackpot-digit-dt')
    
    // 初始化数字
    var digit_pt = 411264389.95,
        digit_dt = 1448833.64

    var timer_pt,
        timer_dt,
        // 间隔
        interval_pt = 100,
        interval_dt = 100,
        // 最大随机数 0-max,注意包括后面两位小数，所以需要乘以100
        max_pt      = 10 * 100,
        max_dt      = 10 * 100

    timer_pt = setInterval(timerHandler_pt, interval_pt)
    timer_dt = setInterval(timerHandler_dt, interval_dt)

    function timerHandler_pt() {
      $digit_pt.html(format(digit_pt))
      
      // 这里做数字改动
      // 随机加了一个数
      digit_pt += _.random(max_pt) / 100
    }

    function timerHandler_dt() {
      $digit_dt.html(format(digit_dt))

      digit_dt += _.random(max_dt) / 100
    }
    
    function format(number) {
      return '<div class="digit-item-pure">' + number.toMoney().split('').join('</div><div class="digit-item-pure">') + '</div>'
    }
  })()
  /* /奖池 */

})(jQuery, window, document)